package com.lrm.biz.impl;

import com.lrm.biz.IUserBiz;
import com.lrm.dao.UserJPA;
import com.lrm.pojo.User;
import com.lrm.util.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 王金海
 * @Description:
 * @Date: Created by Administrator on 2017/11/30.
 * @Modified By:
 */
@Service
public class UserBizImpl implements IUserBiz {

    @Autowired
    private UserJPA userJPA;
    @Override
    public User checkUser(String username, String password) {
//        Userbean userbean = new Userbean();
        User o = userJPA.findByUsernameAndPassword(username, MD5.md5(password));
//        BeanUtils.copyProperties(o,userbean);
//        System.out.println(userbean);
        return o;
    }

    @Override
    public List<User> listUser() {
        List<User> all = userJPA.findAll();
        return all;
    }
}
